<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">
<!-- TopJUI框架样式 -->
<link type="text/css" href="../../topjui/themes/default/topjui.core.min.css" rel="stylesheet">
<link type="text/css" href="../../topjui/themes/default/topjui.blue.css" rel="stylesheet" id="dynamicTheme" />
<!-- FontAwesome字体图标 -->
<link type="text/css" href="../../statics/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<!-- layui框架样式 -->
<link type="text/css" href="../../statics/plugins/layui/css/layui.css" 	rel="stylesheet" />
<!-- jQuery相关引用 -->
<script type="text/javascript" src="../../statics/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../statics/plugins/jquery/jquery.cookie.js"></script>
<!-- TopJUI框架配置 -->
<script type="text/javascript" src="../../statics/public/js/topjui.config.js"></script>
<!-- TopJUI框架核心-->
<script type="text/javascript" src="../../topjui/js/topjui.core.min1.js"></script>
<!-- TopJUI中文支持 -->
<script type="text/javascript" src="../../topjui/js/locale/topjui.lang.zh_CN.js"></script>
<!-- layui框架js -->
<script type="text/javascript" src="../../statics/plugins/layui/layui.js" charset="utf-8"></script>
</head>
<body>
	<div data-toggle="topjui-layout" data-options="fit:true">
		<div
			data-options="region:'center',title:'',fit:true,split:true,border:false">
			<!-- datagrid表格 -->
			<table data-toggle="topjui-datagrid" class="productDg1"
				data-options="id: 'chkcountDg',
               				fitColumns:true,
              				remoteSort:false,
               				method:'get',
               				url: '/chkcount/queryChkcount'">
				<thead>
					<tr>
						<th data-options="field:'chkpointname',title:'巡查地点',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'allDefNum',title:'规定巡查次数',sortable:true,width:100,align:'center'"></th>
						<th data-options="field:'realNum',title:'实际巡查次数',sortable:true,width:100,align:'center'"></th>
						<th data-options="field:'okNum',title:'正常次数',sortable:true,width:100,align:'center'"></th>
						<th data-options="field:'errNum',title:'异常次数',sortable:true,width:100,align:'center'"></th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
	<!-- layout布局 结束 -->

	<!-- 表格工具栏开始 -->
	<div id="chkcountDg-toolbar" class="topjui-toolbar" data-options="grid:{type:'datagrid',id:'chkcountDg' }">
       <a href="javascript:void(0)" data-toggle="topjui-menubutton"
			data-options="btnCls:'topjui-btn-green'" onclick="exportExcel()">生成excel</a>
		<form id="queryForm" class="search-box">
			<input type="text" name="stime" data-toggle="topjui-datebox"
				data-options="id:'stime',prompt:'开始时间',width:250">
			<input type="text" name="etime" data-toggle="topjui-datebox"
				data-options="id:'etime',prompt:'截止时间',width:250">
            <input type="text" name="chkpointid" id="chkpointid"
                   data-toggle="topjui-combobox"
                   data-options="required:false,
               prompt:'地点',
               width:200,
               valueField:'id',
               textField:'text',
               method:'get',
               url:'/chktask/queryChkpoint'">
                      	
			<a href="javascript:void(0)" data-toggle="topjui-menubutton"
				data-options="
           					iconCls:'fa fa-search',
           					btnCls:'topjui-btn-blue',
							
							method:'query',
           					form:{id:'queryForm'},
           					grid:{type:'datagrid','id':'chkcountDg'}">查询</a>
		</form>
	<br><br>
	</div>
	<!-- 表格工具栏结束 --> 

<script>
$(function(){ 
	//alert("chkcount.html加载完毕");//测试加载后执行 
	
	//定义行点击函数
	$("#chkcountDg").datagrid({    
	    onClickRow: function (index, row) 
	   	{  
	    	alert("行数是:"+index+"  巡查点是:"+row.chkpointname);
	   	}  
	});
	
	//定义日期控件不能选择当前日期之后的日期
    $('#stime').datebox('calendar').calendar({
        validator: function(value){
            var now = new Date();
            return value <= now;
        }
    });
    $('#etime').datebox('calendar').calendar({
        validator: function(value){
            var now = new Date();
            return value <= now;
        }
    });
	
});

function exportExcel()
{
	//alert("这里会模拟提交表单，先实现与查询按钮相同的功能！");
	var stime=$('#stime').datebox('getValue');
	var etime=$('#etime').datebox('getValue');
	var chkpointid=$('#chkpointid').combobox('getValue');
	var formData = $("#queryForm").serialize();
	debugger;
	window.location.href = encodeURI("/report/chkcountExcel?stime="+stime+"&etime="+etime+"&chkpointid="+chkpointid);
}

/**
function demo()
{
	//$.messager.progress();	// 显示进度条
	$.post('/report/chkcountExcel',formData,function (res,status) {
        debugger;
		if (status == 'success') { // 后台返回状态值
        	//$("#chkcountDg").datagrid("loadData", res.rows);
    		//$.messager.progress('close');	// 隐藏进度条
        } else {}
    },'JSON');
}
function expExcel()
{
	alert("这里会模拟提交表单，先实现与查询按钮相同的功能！");
	$.messager.progress();	// 显示进度条
	var stime=$('#stime').datebox('getValue');
	var etime=$('#etime').datebox('getValue');
	var chkpointid=$('#chkpointid').combobox('getValue');
	debugger;
	var formData = $("#queryForm").serialize();
	if(etime<stime)
	{
		alert("截止时间不能早于开始时间");
		$.messager.progress('close');	// 如果表单是无效的则隐藏进度条
		return;
	}
	
    $.post('/report/exportExcel',formData,function (res,status) {
        if (status == 'success') { // 后台返回状态值

        } else {

        }
    },'JSON');
}
*/
</script>

</body>
</html>